package com.gxa.service.impl;

import com.gxa.mapper.MerchandiseMapper;
import com.gxa.pojo.Merchandise;
import com.gxa.service.MerchandiseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @program: saas
 * @description:
 * @author: Tirion
 * @create: 2020-09-22 16:05
 **/
@Service("merchandiseService")
public class MerchandiseServiceImpl implements MerchandiseService {

    @Resource
    private MerchandiseMapper merchandiseMapper;


    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,
    rollbackFor = Throwable.class)
    public int deleteByPrimaryKey(Integer id) {
        return merchandiseMapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,
            rollbackFor = Throwable.class)
    public int insertSelective(Merchandise record) {
        merchandiseMapper.addStorage(record);
        return merchandiseMapper.insertSelective(record);
    }


    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT,
            rollbackFor = Throwable.class)
    public Merchandise selectByPrimaryKey(Integer id) {
        return merchandiseMapper.selectByPrimaryKey(id);
    }


    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,
            rollbackFor = Throwable.class)
    public int updateByPrimaryKeySelective(Merchandise record) {
        return merchandiseMapper.updateByPrimaryKeySelective(record);
    }



    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT,
            rollbackFor = Throwable.class)
    public List<Merchandise> fuzzyQuery(String like) {
        return merchandiseMapper.fuzzyQuery(like);
    }


    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT,
            rollbackFor = Throwable.class)
    public List<Merchandise> queryAll() {
        return merchandiseMapper.queryAll();
    }


    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,
    rollbackFor = Throwable.class)
    public int updateStatus(Integer putaway, Integer id) {
        return merchandiseMapper.updateStatus(putaway,id);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public Integer deleteBatch(List<Integer> arr) {
        return merchandiseMapper.deleteBatch(arr);
    }

    @Override
    public List<Merchandise> isPutaway() {
        return merchandiseMapper.isPutaway();
    }

    @Override
    public List<Merchandise> notPutaway() {
        return merchandiseMapper.notPutaway();
    }

    @Override
    public List<Merchandise> conjunctiveQuery(Map<String, Object> map) {
        return merchandiseMapper.conjunctiveQuery(map);
    }

    @Override
    public List<String> typeList() {
        return merchandiseMapper.typeList();
    }

    @Override
    public List<String> brandList() {
        return merchandiseMapper.brandList();
    }
}
